package com.molin.networkTest.socketTest.demo4;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.UnknownHostException;

public class Client {
    public static void main(String[] args) throws IOException {
        //广播
        DatagramSocket ds=new DatagramSocket();
        String s="广播消息";
        DatagramPacket dp=new DatagramPacket(s.getBytes(),s.getBytes().length, InetAddress.getByName("255.255.255.255"),8888);

        ds.send(dp);
        ds.close();
    }
}
